<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>环境检测</title>
    <link rel="stylesheet" href="frame/layui/css/layui.css">
    <link rel="stylesheet" href="css/install.css">
</head>
<body>

<!-- main -->
<div class="layui-main">
    <h1 class="site-h1">环境检测</h1>
    <!-- table -->
    <table class="layui-table" lay-skin="line">
        <tr>
            <th width="25%">环境</th>
            <th width="25%">最低配置</th>
            <th width="25%">当前配置</th>
            <th width="25%">是否符合</th>
        </tr>
        <tr>
            <td>操作系统</td>
            <td>不限</td>
            <td><?php echo php_uname('s'); ?></td>
            <td class="yes">√</td>
        </tr>
        <tr>
            <td>php版本</td>
            <td>&gt;5.3</td>
            <td><?php echo PHP_VERSION ?></td>
            <?php $php_version=explode('.', PHP_VERSION); ?>
            <td class="<?php if(($php_version['0']>=7) || ($php_version['0']>=5 && $php_version['1']>=3))echo 'yes'; ?>">
                <?php if (($php_version['0']>=7) || ($php_version['0']>=5 && $php_version['1']>=3)): ?>
                √
                <?php else: ?>
                ×
                <?php endif ?>
            </td>
        </tr>
    </table>
    <!-- directory right -->
    <table class="layui-table" lay-skin="line">
        <tr>
            <th width="25%">目录</th>
            <th width="25%">最低配置</th>
            <th width="25%">当前配置</th>
            <th width="25%">是否符合</th>
        </tr>
        <tr>
            <td>../</td>
            <td>可写</td>
            <td>
                <?php if (is_writable('../')): ?>
                可写
                <?php else: ?>
                不可写
                <?php endif ?>
            </td>
            <td class="<?php if(is_writable('../'))echo 'yes'; ?>">
                <?php if (is_writable('../')): ?>
                √
                <?php else: ?>
                ×
                <?php endif ?>
            </td>
        </tr>
        <tr>
            <td>../install</td>
            <td>可写</td>
            <td>
                <?php if (is_writable('../install')): ?>
                可写
                <?php else: ?>
                不可写
                <?php endif ?>
            </td>
            <td class="<?php if(is_writable('../install'))echo 'yes'; ?>">
                <?php if (is_writable('../install')): ?>
                √
                <?php else: ?>
                ×
                <?php endif ?>
            </td>
        </tr>
        <tr>
            <td>../Runtime</td>
            <td>可写</td>
            <td>
                <?php if (is_writable('../Runtime')): ?>
                可写
                <?php else: ?>
                不可写
                <?php endif ?>
            </td>
            <td class="<?php if(is_writable('../Runtime'))echo 'yes'; ?>">
                <?php if (is_writable('../Runtime')): ?>
                √
                <?php else: ?>
                ×
                <?php endif ?>
            </td>
        </tr>
        <tr>
            <td>../Common/Conf/</td>
            <td>可写</td>
            <td>
                <?php if (is_writable('../Common/Conf/')): ?>
                可写
                <?php else: ?>
                不可写
                <?php endif ?>
            </td>
            <td class="<?php if(is_writable('../Common/Conf/'))echo 'yes'; ?>">
                <?php if (is_writable('../Common/Conf/')): ?>
                √
                <?php else: ?>
                ×
                <?php endif ?>
            </td>
        </tr>
    </table>
    <!-- btn -->
    <div class="btn-box">
        <a class="layui-btn layui-btn-small layui-btn-normal" href="./index.php?type=<?php echo $config['indexPage']; ?>">上一步</a>
        <a class="layui-btn layui-btn-small next" href="javascript:;" url-href="./index.php?type=<?php echo $config['createPage']; ?>">下一步</a>
    </div>
</div>

<script type="text/javascript" src="frame/layui/layui.js"></script>
<script>
    layui.use('layer', function(){
        var $ = layui.jquery,layer = layui.layer;

        // 判断是否通过
        $('.next').on('click',function(){
            // 判断检测是否达标
            if($('.yes').length != 6){
                layer.msg('您的配置或权限未满足要求');
            }else{
                location.href = $(this).attr('url-href');
            }
        });
    });
</script>
</body>
</html>